/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.oa.web;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.common.web.BaseController;

import com.thinkgem.jeesite.modules.oa.entity.CarAnalyzeVo;
import com.thinkgem.jeesite.modules.oa.service.CarAnalyzeService;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 派车单查询
 *
 * @author ThinkGem
 * @version 2014-05-16
 */
@Controller
@RequestMapping(value = "${adminPath}/oa/carAnalyze")
public class CarAnalyzeController extends BaseController {

    @Autowired
    private CarAnalyzeService carAnalyzeService;

    @ModelAttribute
    public CarAnalyzeVo get(@RequestParam(required = false) String id) {
        CarAnalyzeVo entity = null;
        if (StringUtils.isNotBlank(id)) {
            entity = carAnalyzeService.get(id);
        }
        if (entity == null) {
            entity = new CarAnalyzeVo();
        }
        return entity;
    }

    @RequiresPermissions("oa:carAnalyze:view")
    @RequestMapping(value = {"list", ""})
    public String list(CarAnalyzeVo oaCarQryVo, HttpServletRequest request, HttpServletResponse response, Model model) {
        Page<CarAnalyzeVo> page = carAnalyzeService.find(new Page<CarAnalyzeVo>(request, response), oaCarQryVo);
        model.addAttribute("page", page);
        return "modules/oa/carAnalyzeList";
    }

}